package com.util;

import com.arcsoft.ASVLOFFSCREEN;
import com.arcsoft.FaceInfo;
import com.face.client.model.AFDEngine;
import com.face.client.model.AFTEngine;

import java.io.IOException;
import java.io.InputStream;

/*获取面部信息的帮助类*/
public class FaceUtils {

    /**
     * 使用face-Trace 检测途中的人脸
     * @param asvloffscreen
     * @return
     */
    public static FaceInfo[] getFaceByFT(ASVLOFFSCREEN asvloffscreen) {
        AFTEngine engine = new AFTEngine();
        return engine.getFaceInfo(asvloffscreen);
    }

    public static FaceInfo[] getFaceByFD(ASVLOFFSCREEN asvloffscreen) {
        AFDEngine fdEngine = new AFDEngine();
        return fdEngine.getFaceInfo(asvloffscreen);
    }

    public static FaceInfo[] getFaceInfos(InputStream inputStream) throws IOException {
        ASVLOFFSCREEN asvloffscreen = ImageUtils.loadImage(inputStream);
        return getFaceByFD(asvloffscreen);
    }


}
